All Questions
9 questions
5votes
3answers
220views
Detect loop in rectilinear path
Given a rectilinear path, find if it has a loop. A rectilinear path is made up of made up of alternating horizontal and vertical segments. Input => Ordered set of points representing ra ectilinear ...
7votes
3answers
3kviews
Determine if a triangle is equilateral, isosceles, or scalene
I've been fiddling around with some easy code challenges and there's one about determining if a triangle is equilateral, isosceles, or scalene. I've come up with a working solution, but I feel this ...
5votes
2answers
3kviews
Given a list of coordinates check if 4 points make a line
I was doing some preparation for coding interviews and I came across the following question: Given a list of coordinates "x y" return True if there exists a line ...
12votes
1answer
7kviews
2D Bin Packing Algorithm Implementation
I wrote a 2D greedy bin packing algorithm using Python 3.6 Heres a quick summary: The algorithm consists of two classes (which I will attach at the end of this file along with a link to my github repo)...
5votes
1answer
1kviews
Shortest path around a set of points
Problem I'm trying to get into Python and get a bit familiar with it, so I found a problem online to train. The problem was to find the shortest path around some points, given a set of nodes which ...
6votes
1answer
2kviews
Calculate angle between planes
I have written working code calculating the angle between the adjacent planes. I read subsequently from standart input: n - amount of triangles, m - amount of vertices ind[] - indices of the vertices ...
2votes
2answers
508views
Python Kohonen algorithm
I've tried to implement the Kohonen algorithm using Python and I've managed to do this, but my result is so slow. I want to know if anyone knows how I can improve it. Objective: I have to read a file ...
5votes
2answers
14kviews
Closest distance between points in a list
In a course I'm doing, I was given the task of finding the closest pair of points among the given points. The program that passed all test cases was the following: ...
11votes
3answers
7kviews
Python implementation of the Ramer-Douglas-Peucker Algorithm
I recently implemented the RDP polygon approximation algorithm in Python and I'm skeptical of whether or not I implemented it correctly of with the greatest efficiency. The algorithm runs in around 0....